package com.itgungnir.designpattern.mediator;

public class Test {
	public static void main(String[] args) {
		// 初始化聊天室对象
		ChatRoom chatRoom = new ChatRoom();
		// 向聊天室中添加用户
		User chatter1 = new User("Chatter1");
		User chatter2 = new User("Chatter2");
		User chatter3 = new User("Chatter3");
		User chatter4 = new User("Chatter4");
		User chatter5 = new User("Chatter5");
		User chatter6 = new User("Chatter6");
		chatRoom.addUser(chatter1);
		chatRoom.addUser(chatter2);
		chatRoom.addUser(chatter3);
		chatRoom.addUser(chatter4);
		chatRoom.addUser(chatter5);
		chatRoom.addUser(chatter6);
		System.out.println();
		// 用户之间开始交流
		chatter1.sendMessage(chatRoom, "大家好，我是Chatter1");
		System.out.println();
		chatter4.sendMessage(chatRoom, "你好，Chatter1");
	}
}